home *** CD-ROM | disk | FTP | other *** search
/ Resource for Source: C/C++ / Resource for Source - C-C++.iso / codelib8 / v_10_08 / 1008012b < prev    next >
Encoding:
Text File  |  1995-11-01  |  339 b   |  19 lines

  1.  
  2. Listing 2 -- atexit.c
  3.  
  4. /* atexit function */
  5. #include <stdlib.h>
  6.  
  7.         /* external declarations */
  8. extern void (*_Atfuns[])(void);
  9. extern size_t _Atcount;
  10.  
  11. int (atexit)(void (*func)(void))
  12.     {    /* function to call at exit */
  13.     if (_Atcount == 0)
  14.         return (-1);    /* list is full */
  15.     _Atfuns[--_Atcount] = func;
  16.     return (0);
  17.     }
  18.  
  19.